package com.example.mapper;

import com.example.entity.RegistrationForm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 操作RegistrationForm相关数据接口
*/
public interface RegistrationFormMapper {

    /**
      * 新增
    */
    int insert(RegistrationForm RegistrationForm);

    /**
      * 删除
    */
    int deleteById(Integer id);

    /**
      * 修改
    */
    int updateById(RegistrationForm RegistrationForm);

    /**
      * 根据ID查询
    */
    RegistrationForm selectById(Integer id);

    /**
      * 查询所有
    */
    List<RegistrationForm> selectAll(RegistrationForm RegistrationForm);


/*    @Select("select patients.name, doctor.name, visit_date_time, status, created_time\n" +
            "from registrationform,doctor,patients \n" +
            "where patients.username = registrationform.patient_id and doctor.username = registrationform.doctor_id \n" +
            "and doctor_id = #{doctor_id}")*/

    /*@Select("select patients.name as patientName,\n" +
            "doctor.name as doctorName,\n" +
            "registrationform.id, doctor_id, patient_id, visit_date_time, status, created_time\n" +
            "from registrationform,doctor,patients \n" +
            "where patients.id = registrationform.patient_id and doctor.id = registrationform.doctor_id \n" +
            "and doctor_id = #{doctor_id} ")*/

    /**
     * 根据医生的分页查询挂号单
     * @param registrationForm
     * @return
     */
    List<RegistrationForm> selectPageInDoctor(RegistrationForm registrationForm);

    @Select("SELECT * FROM registrationform WHERE registration_number = #{registrationNumber}")
    RegistrationForm selectByFormNumber(String registrationNumber);
}